<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>静待花开</title><meta name="author" content="brad 随风起舞"><meta name="copyright" content="brad 随风起舞"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="有些事情需要一辈子的沉淀">
<meta property="og:type" content="website">
<meta property="og:title" content="静待花开">
<meta property="og:url" content="https://zhangbo4881820.gitee.io/myblog/page/3/index.html">
<meta property="og:site_name" content="静待花开">
<meta property="og:description" content="有些事情需要一辈子的沉淀">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png">
<meta property="article:author" content="brad 随风起舞">
<meta property="article:tag" content="java,编程,生活">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png"><link rel="shortcut icon" href="/myblog/img/favicon.png"><link rel="canonical" href="https://zhangbo4881820.gitee.io/myblog/page/3/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/myblog/css/index.css"><link rel="stylesheet" href="/myblog/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="/myblog/css/fancybox.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/myblog/',
  algolia: undefined,
  localSearch: {"path":"/myblog/search.xml","preload":false,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '静待花开',
  isPost: false,
  isHome: true,
  isHighlightShrink: true,
  isToc: false,
  postUpdate: '2023-09-15 15:58:17'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 7.0.0-rc2"><link rel="alternate" href="/myblog/atom.xml" title="静待花开" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/myblog/archives/"><div class="headline">文章</div><div class="length-num">57</div></a><a href="/myblog/tags/"><div class="headline">标签</div><div class="length-num">20</div></a><a href="/myblog/categories/"><div class="headline">分类</div><div class="length-num">25</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/myblog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 分享</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/myblog/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page child" href="/myblog/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/myblog/movies/"><i class="fa-fw fas fa-video"></i><span> 视频</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/myblog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="not-top-img" id="page-header"><nav id="nav"><span id="blog-info"><a href="/myblog/" title="静待花开"><span class="site-name">静待花开</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/myblog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 分享</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/myblog/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page child" href="/myblog/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/myblog/movies/"><i class="fa-fw fas fa-video"></i><span> 视频</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/myblog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/15287/" title="mysqlCookBook02">mysqlCookBook02</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-26T07:47:16.000Z" title="发表于 2019-11-26 15:47:16">2019-11-26</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/mysql/">mysql</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/mysql/">mysql</a></span></div><div class="content">数据表管理主要内容:

表克隆
从一个表复制到另一个表
使用临时表
生成唯一表名字
决定一个表使用什么存储引擎或者从一个存储引擎转换成另一个

克隆一个表使用CREATE TABLE … LIKE去克隆表结构但是有些异常情况:他不能复制外键的定义,也不能复制任何数据方向(DATA DIRECTION),或索引方向(INDEX DIRECTION)表选项,表可能使用的选项.
克隆出来是一个空表.
从一个表复制到另一个表使用INSERT INTO … SELECT去复制一些或全部来自原始表的行到一个新表INSERT INTO new_table SELECT * FROM original_table; 如果要添加适当得部分,那么可以加where条件.如果表不存在可以这么干:CREATE TABLE ... SELECT 
临时表你可能仅仅短时间需要一个表,之后你想要这个表自动消失.那么就用临时表.使用TEMPORARY关键字.如下面创建方式:

有明确行定义的创建临时表
  CREATE TEMPORARY TABLE tbl_name ( ... column definitions. ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/15095/" title="mysqlCookBook01">mysqlCookBook01</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-25T09:02:53.000Z" title="发表于 2019-11-25 17:02:53">2019-11-25</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/mysql/">mysql</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/mysql/">mysql</a></span></div><div class="content">设置mysql用户账户假设已经完成了msql的安装.这里我们使用命令行在windows上来设置:

用系统root用户登陆mysql服务的命令语句如下:

mysql -h localhost -u root -p Enter password: ****** 或者: mysql –host&#x3D;localhost –user&#x3D;root –password&#x3D;pass 一般默认host就是localhost 因此,如果是localhost,host可以不用写 mysql -u root -p


然后创建一个用户

CREATE USER ‘cbuser‘@’localhost’ IDENTIFIED BY ‘cbpass’; Query OK, 0 rows affected (0.01 sec)


给用户分配权限

GRANT ALL ON cookbook.* TO ‘cbuser‘@’localhost’; Query OK, 0 rows affected (0.01 sec)


退出MySQL

quit



创建数据库和数据表
建数据库

c ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/27749/" title="数据结构(JAVA)第五天(search)">数据结构(JAVA)第五天(search)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-22T08:58:40.000Z" title="发表于 2019-11-22 16:58:40">2019-11-22</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">数据结构</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/">计算机基础</a></span></div><div class="content">搜索是什么在计算机科学当中,搜索时从一个集合条目当中根据指定属性查找条目的过程.这个条目可能是存储记录在数据库,简单的数组元素,文件中的文本,树的节点图的顶点和边缘,或者是其他搜索空间的元素.
为什么需要搜索搜索(searching)是计算机科学算法当中的核心之一.我们都知道今天的电脑存储着大量的信息.为了高效的获取信息,我们就需要非常高效的搜索算法.
搜索类型
无序线性搜索

有序线性搜索

二分查找

符号表和hashing

字符串搜索算法: 尝试三进制搜索和后缀树


无序线性搜索首先我们假定有一个元素顺序不知道的一个数组.这种情况下查找元素,就不得不扫描整个数组,来确定是否有这个元素.
时间复杂度: O(n)
空间复杂度: O(1)
有序线性搜索如果数组元素是有序的,那么大多数情况下不需要扫描整个数组,来确定是否有这个元素.在下面的算法代码中可以知道,任何位置的值A[i],只要大于给定要搜索的数据值那么数组后面的元素就不需要扫描了.
public int OrderedLinearSearch(int[] A,int data) &#123;    for (int i =  ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/13205/" title="数据结构(JAVA)第五天(sort)">数据结构(JAVA)第五天(sort)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-21T09:00:27.000Z" title="发表于 2019-11-21 17:00:27">2019-11-21</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">数据结构</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/">计算机基础</a></span></div><div class="content">什么是排序排序是一种算法，它以某种顺序（升序或降序）排列列表的元素。输出是输入的排列或重新排序
排序的必要性在计算机科学中排序是非常重要的一种算法类目并且很多搜索会涉及这个算法类目.它对于减少问题的复杂性有重要意义并且经常用于数据库算法和搜索
排序算法的归类
基于比较次数对于基于比较的排序算法，最佳情况下的行为为O(nlogn),最坏情况下的行为为O(n2).基于比较的排序算法通过键比较操作来评估列表的元素,并且大多数输入至少需要O(nlogn)的比较。

基于交换次数

基于内存使用一些排序算法是“就地(in place)”的,它们需要O(1)或O(logn)空间复杂度的内存来创建用于临时排序数据的辅助位置

基于递归

By Stability如果对于所有索引i和j，使得键A [i]等于键A [j]，并且如果记录R [i]在原始文件中的记录R [j]之前,在排序列表中R [i]在R [j]之前,则排序算法是稳定的

自适应(Adaptability)使用一些排序算法，复杂度会根据预排序[快速排序]而改变：输入的预排序会影响运行时间。考虑到这一点的算法就是自适应(Adaptabili ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/5832/" title="数据结构(JAVA)第四天(hash)">数据结构(JAVA)第四天(hash)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-21T03:59:47.000Z" title="发表于 2019-11-21 11:59:47">2019-11-21</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">数据结构</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/">计算机基础</a></span></div><div class="content">啥是hashhash用来尽可能快的存储和获取数据的一种数据结构.被用于高效搜索并且对于符号表单的实现是非常有用的.
hash的插入,删除,搜索的平均复杂度是O(1)这是最快的,最坏情况是O(n).平衡二叉树是O(logn)
如何理解hash简单点就是我们可以把数组当作一个hash表.然后用一个例子来理解下:如果数据中有重复的元素，则给出一种用于打印第一个重复字符的算法。让我们考虑可能的解决方案。简单而蛮力的解决方法是：给定一个字符串，对于每个字符，检查该字符是否重复。该方法的时间复杂度为O(n2，空间复杂度为O(1)。
现在换一种高效的办法.由于我们的目标是找到第一个重复的字符，如果我们记得某个数组中的前一个字符怎么办
假定仅仅是标准的ASCII字符表.那么可能的字符数是256.创建一个256大小的数组并且用0初始化填充.对于每一个输入字符转到对应的位置并且增加一个计数.由于我们使用数组,所有插入到对应位置只需要消耗常量时间.在我们扫描输入时,如果我们得到一个字符发现他的位置的计数值为1然后就可以认定这个字符是第一次重复的字符
这是在假定可能最大就256个字符数.但是实际情况可能是无穷 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/42431/" title="数据结构(JAVA)第三天(linked)">数据结构(JAVA)第三天(linked)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-20T10:33:55.000Z" title="发表于 2019-11-20 18:33:55">2019-11-20</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">数据结构</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/">计算机基础</a></span></div><div class="content">Linked 链表数据结构什么是链表具备如下特征:

连续的元素是通过指向器链接的

最后一个元素指向 NULL

在程序执行起见大小可扩充或者收缩

需要多长就能多长(除非超出系统的内存空间)

不浪费内存空间(但是会花费额外的内存给指向器).内存就划分就像列表的增长



数组的优势

简单易用
快速的元素访问(索引常量访问)

数组的劣势

预先分配数组所需要的全部内存并且在一个空数组中的建立数组索引浪费内存空间

固定大小(Fixed size): 数组大小是静态的(就是在使用前要指定好大小)

大块内存分配(One block allocation): 要在开始时数组本身分配内存，有时可能无法获取整个数组的内存（如果数组很大）

基于插入位置的复杂性(Complex position-based insertion): 为了在给定位置插入元素,我们可能需要移动存在的元素.如果我们在开始位置插入元素,那么所有的元素都需要移动位置,将带来大量的性能消耗.


动态数组(Dynamic Arrays)动态数组(也称为增长数组,扩容数组,动态表单,数组列表)是一个随机访问,大小可变的 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/43462/" title="数据结构(JAVA)第二天(tree)">数据结构(JAVA)第二天(tree)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-20T07:02:21.000Z" title="发表于 2019-11-20 15:02:21">2019-11-20</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">数据结构</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/">计算机基础</a></span></div><div class="content">tree树形结构

树的根部节点是没有父节点的.一颗树种最多一个根节点(图种A就是根节点)

父子之间的链接从节点边缘开始

一个没有子节点的节点被称为叶子节点(leaf node)

子节点有共同的父系节点的称为兄弟节点(siblings) 

如果存在一条根节点到 q 的路径并且 p 出现在此路径上,那么我们称 p 是 q 的祖先节点, q 是 p 的后代节点.例如图中:A,C,G就是K的祖先节点

所有的处于同一个给定深度的节点集我们称之为树的级别(level).根节点处于零级别.(B,C,D是同一个级别)

一个节点的深度是从根节点到这个节点的路径长度.(G的深度是2,A-C-G)

一个节点的高度是从这个节点到最深的节点的路径长度.一棵树的高度就是根节点到最深节点的路径长度.一个树只有一个根节点那么他的高度为零.(B的高度是2,B-F-J)

树的高度和深度在所有节点中都是最大的.对于一个给定的树,深度和高度返回相同的值.但是对于一些独立的节点,我们可能会得到不同的结果.

节点的大小就是包含本身以及所有后代节点的数量(C的大小就是3)

如果一个树中每个节点仅仅只有一个子节 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/14780/" title="数据结构(JAVA)第一天(概念)">数据结构(JAVA)第一天(概念)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-19T03:16:18.000Z" title="发表于 2019-11-19 11:16:18">2019-11-19</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">数据结构</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/">计算机基础</a></span></div><div class="content">变量(variables)变量就是数据的载体.
数据类型数据类型是为了计算机编程科学的目的而使用的名字.在编程语言中数据类型是预先定义值的数据的集合.例如,integer,floating point,String等
在顶层只有两种数据类型:

系统定义的数据类型(也称为基本数据类型)
用户定义的数据类型

系统定义的数据类型这中数据结构大小依赖于编程语言,编译器和操作系统.例如一个int类型可能占2字节(byte)也可能4字节.当它占2字节时候意味着占16位(bits)那么值的范围就是(-215到-215-1).
用户定义的数据类型在java里面可以通过定义一个类来自定义数据类型.
数据结构数据结构是以一种指定的数据存储结构的方式.一般的数据结构包括:数组(arrays),文件(files),链表(linked),列表(lists),堆(stack),队列(queues),树(tree),图表(graphs)等等
根据数据元素的构成,数据结构被归为两类:

线性数据结构: 元素的访问是有序的,但是不要求一定要有序的的存入元素.像链表,列表等.
非线性数据结构: 这种数据结构的数据以一 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/34744/" title="计算机的基本组成(第一天)">计算机的基本组成(第一天)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-19T01:17:39.000Z" title="发表于 2019-11-19 09:17:39">2019-11-19</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BB%84%E6%88%90/">计算机组成</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/">计算机基础</a></span></div><div class="content">计算机的基本组成冯*诺伊曼计算机特点
计算机由运算器,存储器,控制器,输入设备和输出设备五大部件组成.
指令和数据以同等地位存放于存储器内,并可按地址寻址.
指令和数据均采用二进制数表示.
指令由操作码和地址码组成,操作码用来表示操作的性质,地址码用来表示操作数在存储器中的位置.
指令在存储器内按顺序存放.通常指令是顺序执行的,在特定条件下,可根据运算结果或设定的条件改变执行顺序.
机器以运算器为中心,输入输出设备与存储器间的数据传送通过运算器完成.


图中各个部件功能如下:

运算器用来完成算数运算和逻辑运算,并将运算的中间结果暂存在运算器内.
存储器用来存放数据和程序.
控制器用来控制,指挥程序和数据的输入,运行以及处理运算结果
输入设备用来将人们熟悉的信息形式转换为计算机能识别的信息形式,常见键盘.
输出设备可将机器运算结果转换为人们熟悉的信息形式.如打印机

现代计算机
现代计算机可以认为由三大部分组成:CPU,I&#x2F;O,主存储器(可直接与CPU交换信息)
计算机工作步骤通常包含两大步骤:上机前准备和上级运行.
上机前准备

建立数学模型
确定计算方法
编制解题程序
 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/myblog/posts/17440/" title="mysql-index">mysql-index</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-14T09:26:21.000Z" title="发表于 2019-11-14 17:26:21">2019-11-14</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/myblog/categories/mysql/">mysql</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/myblog/tags/mysql/">mysql</a></span></div><div class="content">mysql 的索引学习.mysql的索引搜索是从最左边的前缀开始的,所以定义索引的列的顺序很重要.
索引类型B-Tree indexes当人们谈论索引没有提及索引类型的时候,基本上都是在谈论B-Tree索引,这种索引使用B-Tree数据结构储存数据.InnoDB存储引擎使用B+Trees.MyISAM存储引擎使用一种前缀表达式技术使得索引更小,但是InnoDB在索引留下了未被压缩的值.MyISAM的索引通过他们的物理存储位置去指向被索引的行,而InnoDB是通过主键值去指向行的.每种形式都有利有弊.
通常B-Tree储存的所有值按顺序存放,每个叶子距离根部的距离都相等.MyISAM使用不同的结构,但主要的都相同.下图抽象展示B-Tree索引的工作情况.
B-Tree索引之所以能够快速访问数据,是因为存储引擎并没有全表去查找想要的数据.相反的,它在根节点开始(上图中未展示),然后根据节点对子节点的指向寻找.这个指向是根据节点页上我们定义的值为边边界分为大于边界一边和小于边界一边.最终找到或找不到.
现在假定你有下面这个表:
CREATE TABLE People ( 	last_name ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/myblog/page/2/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/myblog/">1</a><a class="page-number" href="/myblog/page/2/#content-inner">2</a><span class="page-number current">3</span><a class="page-number" href="/myblog/page/4/#content-inner">4</a><span class="space">&hellip;</span><a class="page-number" href="/myblog/page/6/#content-inner">6</a><a class="extend next" rel="next" href="/myblog/page/4/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="this.onerror=null;this.src='/myblog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">brad 随风起舞</div><div class="author-info__description">有些事情需要一辈子的沉淀</div></div><div class="card-info-data site-data is-center"><a href="/myblog/archives/"><div class="headline">文章</div><div class="length-num">57</div></a><a href="/myblog/tags/"><div class="headline">标签</div><div class="length-num">20</div></a><a href="/myblog/categories/"><div class="headline">分类</div><div class="length-num">25</div></a></div><a id="card-info-btn" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/xxxxx" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:xxxxxx@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/15695/" title="jenkins（1）">jenkins（1）</a><time datetime="2023-09-14T02:17:44.000Z" title="发表于 2023-09-14 10:17:44">2023-09-14</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/22012/" title="wsl的Ubuntu子系统（1）">wsl的Ubuntu子系统（1）</a><time datetime="2023-09-13T08:42:19.000Z" title="发表于 2023-09-13 16:42:19">2023-09-13</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/30302/" title="effective-java-(接口优于抽象类)">effective-java-(接口优于抽象类)</a><time datetime="2023-09-12T08:12:48.000Z" title="发表于 2023-09-12 16:12:48">2023-09-12</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/9473/" title="effective-java(创建和销毁对象--组合的形式优于继承)">effective-java(创建和销毁对象--组合的形式优于继承)</a><time datetime="2023-09-11T08:23:19.000Z" title="发表于 2023-09-11 16:23:19">2023-09-11</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/16107/" title="Hello World">Hello World</a><time datetime="2023-09-07T09:44:01.910Z" title="发表于 2023-09-07 17:44:01">2023-09-07</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            <a class="card-more-btn" href="/myblog/categories/" title="查看更多">
    <i class="fas fa-angle-right"></i></a>
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/myblog/categories/CSS/"><span class="card-category-list-name">CSS</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/myblog/categories/Docker/"><span class="card-category-list-name">Docker</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/myblog/categories/HTML/"><span class="card-category-list-name">HTML</span><span class="card-category-list-count">4</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/myblog/categories/JQuery/"><span class="card-category-list-name">JQuery</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/myblog/categories/RabbitMQ/"><span class="card-category-list-name">RabbitMQ</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/myblog/categories/docker/"><span class="card-category-list-name">docker</span><span class="card-category-list-count">3</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/myblog/categories/git/"><span class="card-category-list-name">git</span><span class="card-category-list-count">4</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/myblog/categories/java/"><span class="card-category-list-name">java</span><span class="card-category-list-count">5</span></a></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/myblog/tags/%E9%A1%B9%E7%9B%AE%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7/" style="font-size: 1.3em; color: #99a1ac">项目管理工具</a> <a href="/myblog/tags/%E5%85%AC%E8%80%83/" style="font-size: 1.1em; color: #999">公考</a> <a href="/myblog/tags/%E6%9D%82%E8%B0%88/" style="font-size: 1.1em; color: #999">杂谈</a> <a href="/myblog/tags/Docker/" style="font-size: 1.1em; color: #999">Docker</a> <a href="/myblog/tags/%E6%B6%88%E6%81%AF%E4%B8%AD%E9%97%B4%E4%BB%B6/" style="font-size: 1.2em; color: #999da3">消息中间件</a> <a href="/myblog/tags/springCloud/" style="font-size: 1.2em; color: #999da3">springCloud</a> <a href="/myblog/tags/%E5%AE%B9%E5%99%A8/" style="font-size: 1.2em; color: #999da3">容器</a> <a href="/myblog/tags/jenkins/" style="font-size: 1.1em; color: #999">jenkins</a> <a href="/myblog/tags/mysql/" style="font-size: 1.3em; color: #99a1ac">mysql</a> <a href="/myblog/tags/%E5%B0%8F%E6%93%8D%E4%BD%9C/" style="font-size: 1.3em; color: #99a1ac">小操作</a> <a href="/myblog/tags/java/" style="font-size: 1.5em; color: #99a9bf">java</a> <a href="/myblog/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/" style="font-size: 1.5em; color: #99a9bf">计算机基础</a> <a href="/myblog/tags/%E5%AE%9E%E6%88%98/" style="font-size: 1.4em; color: #99a5b6">实战</a> <a href="/myblog/tags/HTML/" style="font-size: 1.3em; color: #99a1ac">HTML</a> <a href="/myblog/tags/reg/" style="font-size: 1.2em; color: #999da3">reg</a> <a href="/myblog/tags/%E5%89%8D%E7%AB%AF%E7%9F%A5%E8%AF%86/" style="font-size: 1.2em; color: #999da3">前端知识</a> <a href="/myblog/tags/markDown/" style="font-size: 1.2em; color: #999da3">markDown</a> <a href="/myblog/tags/python/" style="font-size: 1.1em; color: #999">python</a> <a href="/myblog/tags/linux/" style="font-size: 1.1em; color: #999">linux</a> <a href="/myblog/tags/springBoot/" style="font-size: 1.2em; color: #999da3">springBoot</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/myblog/archives/2023/09/"><span class="card-archive-list-date">九月 2023</span><span class="card-archive-list-count">5</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/myblog/archives/2023/08/"><span class="card-archive-list-date">八月 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/myblog/archives/2019/12/"><span class="card-archive-list-date">十二月 2019</span><span class="card-archive-list-count">11</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/myblog/archives/2019/11/"><span class="card-archive-list-date">十一月 2019</span><span class="card-archive-list-count">27</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/myblog/archives/2019/10/"><span class="card-archive-list-date">十月 2019</span><span class="card-archive-list-count">13</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">57</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2023-09-15T07:58:16.468Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By brad 随风起舞</div><div class="framework-info"><span>框架 </span><a href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/myblog/js/utils.js"></script><script src="/myblog/js/main.js"></script><script src="/myblog/js/fancybox.umd.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div class="no-result" id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/myblog/js/search/local-search.js"></script></div></div></body></html>